*** Settings ***
Library    Collections
*** Test Cases ***
Test_Run_My_Keyword
    # ${2.6}是一个float类型
    ${number}=    Set Variable    ${2.6}
    # 这个2.6是string类型，所以是错的
    #2.6 (float) != 2.6 (string)
    Should Be Equal    ${number}    2.6
    # 空值,相当于复制空字符串""
    ${empty_value}=    Set Variable    ${EMPTY}
    Should Be Empty    ${empty_value}

test variable evaluation
    # method1
    ${var1}=    Set Variable    hello,robot
    Log      ${var1}    #hello,robot
    # method2    Get赋值
    ${current_time}=    Get Time
    Log     ${current_time}     #	2024-11-17 12:58:08
    IF  '${var1}'=='hello,robot'
        Log     111
    END
    # 字符串里使用变量
    ${a}    Set Variable    123
    ${str}=    Set Variable       fkhaif${a}gkhf  #	fkhaif123gkhf
    #字符串截取,下标从0开始
    Log    ${str}[3]   #${常用}
    Log    ${str[1]}
#    切片截取
    Log    ${str}[0:4]  #fkha

test number add
    ${call}=    Set Variable    123
    ${call2}=    Evaluate    ${call}+1
    Log    ${call2}
    ${num}=    Set Variable    '123'
    # 需要强转int
    ${num_1}=    Evaluate    (int)(${num})+1
    Should Be Equal    ${num_1}    ${124}
    
test list
    @{list}=    Create List
    Append To List    ${list}   1
    Append To List    ${list}   2
    Log Many    @{list}
    Log   ${list}
